﻿/********************************************************/
/* For 基于.NET的开发技术 课程设计                      */
/*                    学生选课系统                      */
/*author    ：  吴慧文                                  */
/*time      ：  2009年11月8日                           */
/*版本      ：  1.0                                     */
/*文件名    ：  Course.cs                               */
/********************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CMS
{
    [Serializable]
    class Course
    {
        private string id;
        private string name;
        private Teacher theTeacher;
        private int dayOfWeek;//七个选择，一周七天
        private int numOfDay;//五个选择，无大节课

        //构造函数
        public Course(string s1,string s2,Teacher t,int i1,int i2)
        {
            this.Id = s1;
            this.Name = s2;
            this.TheTeacher = t;
            this.DayOfWeek = i1;
            this.NumOfDay = i2;
        }
        
        public string Id 
        {
            get 
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public string Name
        {
            get
            {
                return this.name;
            }
            set
            {
                this.name = value;
            }
        }

        public Teacher TheTeacher
        {
            get
            {
                return this.theTeacher;
            }
            set
            {
                this.theTeacher = value;
            }
        }

        public int DayOfWeek
        {
            get
            {
                return this.dayOfWeek;
            }
            set
            {
                this.dayOfWeek = value;
            }
        }

        public int NumOfDay
        {
            get
            {
                return this.numOfDay;
            }
            set
            {
                this.numOfDay = value;
            }
        }

        //重载Equal函数
        public bool Equals(Course course)
        {
            if (this.Id.Equals(course.Id))
            {
                return true;
            }else
            {
                return false;
            }
        }

        //重载toString函数
        public string toString()
        {
            string result = null;
            result = this.id + "\t\t" + this.Name + "\t\t" + this.TheTeacher.Name+"("+this.TheTeacher.Id+")"
                        +"\t\t"+this.DayOfWeek+"--"+this.NumOfDay;
            return result;
        }
    }
}
